package com.aier.admin.action;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.aier.admin.service.IAssignMessageService;
import com.aier.common.dao.ICommonDAO;
import com.aier.school.entity.School;
import com.aier.user.common.UserFinalPageSize;

@Scope("prototype")
@Component("adminMessageAction")
public class AdminMessageAction extends AdminBaseAction {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    @Resource(name = "assignMessageService")
    private IAssignMessageService assignMessageService;
    //页数
    private int page;
    // 每页显示记录数
    private int page_size;
    // 总页数
    private int page_count;
    // 总数
    private int count;
    //错误码
    private int s;
    
    // 学校列表
    private List<School> schoolList;
    // 学校名称
    private String sname;
    // 学校所在省市编号
    private Integer cid;
    // 短信发送的开始和结束日期
    private String sdate;
    private String edate;
    
    @Override
    public String execute(){
        return SUCCESS;
    }
    
    @SuppressWarnings("unchecked")
    public String searchSchool() {
        if (page <= 0) {
            page = 1;
        }
        Map<String, Object> map = null;
        
        map = assignMessageService.searchSendList(sname, cid,sdate,edate, page, UserFinalPageSize.PROXY_SCHOOLS_PAGESIZE);
        schoolList = (List<School>)map.get(ICommonDAO.OBJ_LIST);
        
        page = (Integer) map.get(ICommonDAO.PAGE);
        page_size = (Integer) map.get(ICommonDAO.PAGE_SIZE);
        page_count = (Integer) map.get(ICommonDAO.PAGE_COUNT);
        count = (Integer) map.get(ICommonDAO.COUNT);
        s = 1;
        return SUCCESS;
    }
    

    public int getPage() {
        return page;
    }


    public void setPage(int page) {
        this.page = page;
    }


    public int getPage_size() {
        return page_size;
    }


    public int getPage_count() {
        return page_count;
    }


    public int getCount() {
        return count;
    }


    public int getS() {
        return s;
    }

    public List<School> getSchoolList() {
        return schoolList;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    public void setCid(Integer cid) {
        this.cid = cid;
    }

    public void setAssignMessageService(IAssignMessageService assignMessageService) {
        this.assignMessageService = assignMessageService;
    }

    public void setSdate(String sdate) {
        this.sdate = sdate;
    }

    public void setEdate(String edate) {
        this.edate = edate;
    }



}
